<template>
  <div>
    <div class="login">
      <div class="head">
        <span>登入</span>
      </div>
        <div class="user">
           <span>用户名</span>
           <br>
           <input type="text" v-model="username">
        </div>
        <div class="password">
           <span>密码</span>
           <br>
           <input type="password" v-model="password">
        </div>
        <div class="logInTo" @click="login">
          <span>登入</span>
        </div>
    </div>
  </div>
</template>

<script>
export default {
    name:'login',
    data() {
      return {
          // 账号
          username:'',
          // 密码
          password:''
      }
    },
    methods:{
      login(){
        let {username,password} = this
        this.$store.dispatch('Login',{username,password});
     }
  }
}
</script>

<style lang="less" scoped>
.login {
  width: 280px;
  height: 220px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -140px;
  margin-left: -110px;
  border: 1px solid #ccc;
  .head{
  height: 30px;
  background:#f2f2f2 ;
  overflow: hidden;
  span{
    display: inline-block;
    margin: 8px 0 0 10px ;
    font-size: 15px;
    color: #333333;
  }
}
}
.user{
  height: 45px;
  margin: 24px 0 0 0 ;
  box-sizing: border-box;
  padding-left: 10px;
  input{
    width: 90%;
  }
}
.password{
  height: 45px;
  margin: 10px 0 0 0 ;
  box-sizing: border-box;
  padding-left: 10px;
  input{
    width: 90%;
  }
}
.logInTo{
  width: 90%;
  height: 30px;
  background: #169bd5;
  margin: 10px 0 0 10px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  span{
    color: #fff;
    font-size: 14px;
  }
}
</style>